import { FAULT_COLOR, NORMAL_COLOR, PASSIVE_COLOR, RECOMMEND_COLOR } from './costant'
import { addOpacity } from './tool'

// 柱形图渐变颜色匹配
export const intervalColor = {
	concealment: [addOpacity(FAULT_COLOR, 1), addOpacity(FAULT_COLOR, 0)],
	activeDiagnosis: [addOpacity(NORMAL_COLOR, 1), addOpacity(NORMAL_COLOR, 0)],
	passiveDiagnosis: [addOpacity(PASSIVE_COLOR, 1), addOpacity(PASSIVE_COLOR, 0)],
	renovate: [addOpacity(RECOMMEND_COLOR, 1), addOpacity(RECOMMEND_COLOR, 0)]
}

// 浮窗配置
export const tooltipConfig = {
	trigger: "item",
	borderColor: "#fff",
	padding: [16, 24],
	extraCssText: "border-radius: 12px;box-shadow: 0px 20px 30px 0px rgba(27, 33, 41, 0.15);",
}

// 图例配置
const lineStyle = {
	text: '',
	width: 22,
	height: 4,
}
const rectStyle = {
	text: '',
	width: 18,
	height: 18,
}
const textStyle = {
	padding: [0, 20, 0, 8],
	color: "#626C78",
	fontSize: 18,
}
// 故障状态
export const legendConfigFault = [
	{
		key: 'a',
		value: {
			backgroundColor: FAULT_COLOR,
			...lineStyle
		}
	},
	{
		key: 'b',
		value: {
			text: '故障',
			...textStyle
		}
	},
	{
		key: 'c',
		value: {
			backgroundColor: NORMAL_COLOR,
			...lineStyle
		}
	},
	{
		key: 'd',
		value: {
			text: '正常',
			...textStyle
		}
	},
	{
		key: 'e',
		value: {
			backgroundColor: 'rgba(245,79,71,0.4)',
			...rectStyle
		}
	},
	{
		key: 'f',
		value: {
			text: '隐匿区间',
			...textStyle
		}
	},
	{
		key: 'g',
		value: {
			backgroundColor: 'rgba(35,111,229,0.4)',
			...rectStyle
		}
	},
	{
		key: 'h',
		value: {
			text: '主动诊断区间',
			...textStyle
		}
	},
	{
		key: 'i',
		value: {
			backgroundColor: 'rgba(35,44,229,0.4)',
			...rectStyle
		}
	},
	{
		key: 'j',
		value: {
			text: '被动诊断区间',
			...textStyle
		}
	},
	{
		key: 'k',
		value: {
			backgroundColor: 'rgba(9,179,181,0.4)',
			...rectStyle
		}
	},
	{
		key: 'l',
		value: {
			text: '整治区间',
			...textStyle
		}
	},
]

// 概率图例
export const legendConfigProbability = [
	{
		key: 'a',
		value: {
			backgroundColor: NORMAL_COLOR,
			...lineStyle
		}
	},
	{
		key: 'b',
		value: {
			text: '原有策略',
			...textStyle
		}
	},
	{
		key: 'c',
		value: {
			backgroundColor: RECOMMEND_COLOR,
			...lineStyle
		}
	},
	{
		key: 'd',
		value: {
			text: '优化推荐',
			...textStyle
		}
	},
]